import Vue from 'vue'
import Router from 'vue-router'
// 这里导入可以让让用户访问的组件
import Home from "../components/Home"
import Login from "../components/Login"
import Register from "../components/Register"
import Course from "../components/Course"
import Detail from "../components/Detail"
import Smart from "../components/Smart"
import Cart from "../components/Cart"
import Order from "../components/Order";
import Success from "../components/Success";
import UserOrder from "../components/UserOrder";

Vue.use(Router);


export default new Router({
  // 设置路由模式为‘history’，去掉默认的#
  mode: "history",
  routes: [
    // 路由列表
    {
      name: "Home",
      path: "/",
      component: Home,
    },
    {
      name: "Login",
      path: "/user/login",
      component: Login,
    },
    {
      name: "Register",
      path: "/user/Register",
      component: Register,
    },
    {
      name: "Course",
      path: "/courses",
      component: Course,
    },
    {
      name: "Detail",
      path: "/courses/detail/:id",
      component: Detail,
    },
    {
      name: "Smart",
      path: "/smart",
      component: Smart,
    },
    {
      name: 'Cart',
      path: '/cart',
      component: Cart,
    },
    {
      name: 'Order',
      path: "/order",
      component: Order,
    },
    {
      name: 'Success',
      path: "/payments/result",
      component: Success,
    },
    {
      name: 'UserOrder',
      path: "/user/order",
      component: UserOrder,
    },
  ]
})
